package com.ss;

import com.ss.service.OrderService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * Hello world!
 */

@Configuration
@EnableAspectJAutoProxy   //开启aop注解支持
@ComponentScan
public class App {
    public static void main(String[] args) {
        ApplicationContext ac = new AnnotationConfigApplicationContext(App.class);
        OrderService os = ac.getBean(OrderService.class);
        System.out.println("---------添加--------");
        os.add("牛奶", 0);
        System.out.println("---------删除--------");
        os.delete("牛奶");
        System.out.println("---------查询--------");
        int number = os.find("牛奶");
        System.out.println("查询到的数量: " + number);
    }
}
